package com.heima.admin.controller.v1;


import com.heima.admin.config.Log;
import com.heima.admin.service.AdUserLogService;
import com.heima.model.admin.dtos.UserLogDTO;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @作者 itcast
 * @创建日期 2021/9/19 11:01
 **/
@Api(value = "频道管理API接口",tags = "频道管理API接口",description = "管理频道相关接口")
@RestController
@RequestMapping("/api/v1/userlog")
public class AdUserLogController {
    @Autowired
    AdUserLogService adUserLogService;

    @Log(value = "分页查询日志列表")
    @ApiOperation(value = "分页查询日志列表",notes = "按照name模糊查询，分页查询 按照ord升序排序")
    @PostMapping("list")
    public ResponseResult list(@RequestBody UserLogDTO dto){
        return adUserLogService.findByNameAndPage(dto);
    }

    @Log(value = "日志删除")
    @ApiOperation("日志删除")
    @GetMapping("/del/{id}")
    public ResponseResult del(@PathVariable Long id) {

        return ResponseResult.okResult(adUserLogService.removeById(id));
    }
}
